<?php
/**
 * demo - receive form data and send answer back
 *
 * @author Sven Ruttloff, www.sruttloff.de <service@sruttloff.de>
 * @copyright Kombitel OhG
 */

/**
 * this constant defines the document root
 */
if (!defined('DOCROOT'))
define('DOCROOT', dirname(dirname(__FILE__)) . '/');
define('WRITEABLEADMINDIR', DOCROOT . '/samples/writeable');

/**
 * PHP5 autoload function for classes
 *
 * @param string class name
 * @return bool
 */
function __autoload($object) {
    $file = DOCROOT . '/phpmy/class/' . strtolower($object) . '.class.php';
    if (!include_once (DOCROOT . '/phpmy/class/' . strtolower($object) . '.class.php'))
       include_once (DOCROOT . '/lib/class/' . strtolower($object) . '.class.php');
    return true;
}

/**
 * load std function lib
 */
require_once (DOCROOT . '/phpmy/function/standard.inc.php');
require_once (DOCROOT . '/phpmy/function/formelements.inc.php');

// called from Backend
$frontend = frontend::getInstance();
$i18n = new i18n('DE');
$frontend->setI18n($i18n);

DEFINE('ASCGRAPH', '<div class="sortdirectionup" style="" title="' . $i18n->Translate('Ascending') . '"></div>');
DEFINE('DESCGRAPH', '<div class="sortdirectiondn" style="" title="' . $i18n->Translate('Descending') . '"></div>');
DEFINE('REQUIREDGRAPH', '<img src="style/image/icon_cross.png" border="0" />');
DEFINE('OKAY', '<img src="style/css/image/apply.png" border="0" />');
DEFINE('MSGHEADOKAY', 'okay');
DEFINE('FAIL', '<img src="style/css/image/messagebox_critical.png" border="0" />');
DEFINE('MSGHEADFAIL', $i18n->Translate('Fehler!'));

$xhr = xhranswer::getInstance();

$xhr->updateValue('answer', 'You send: ' . sendvar('text') . "\n\n" . 'Server Time:' .  date ('d.m.Y H:i:s'));
$xhr->setMsg (OKAY . $i18n->Translate('Successfull saved'), MSGHEADOKAY);

die ($xhr);
